# -*- coding:utf-8 -*-
from twisted.enterprise import adbapi
class SQLiteObject():
    def __init__(self, db):
        """Initialize"""
        self.__dbpool = adbapi.ConnectionPool('sqlite3',
                database=db,
                check_same_thread=False)
        self.__dbpool.start()

    def __del__(self):
        """Shutdown the connection pool"""
        self.__dbpool.close()

    # def process_item(self,item,spider):
    #     """Process each item process_item"""
    #     query = self.__dbpool.runInteraction(self.__insertdata, item, spider)
    #
    # def __insertdata(self,tx,sql, tupleItem):
    #     """Insert data into the sqlite3 database"""
    #     tx.execute(sql, tupleItem)